package ooday02;
//Person家族的测试类
public class ExtendsTest {
    public static void main(String[] args) {
        Student zg = new Student();
        zg.name = "张光";
        zg.age = 18;
        zg.address = "广东";
        zg.className = "2408";
        zg.stuId = "001";
        zg.eat();
        zg.sleep();
        zg.sayHi();
        zg.study();

        Student ll = new Student("李林",20,"北京","2408","002");
        ll.eat();
        ll.sleep();
        ll.sayHi();
        ll.study();

        Teacher zs = new Teacher("张三",30,"上海",5000);
        zs.eat();
        zs.sleep();
        zs.sayHi();
        zs.teach();

        Doctor ls = new Doctor("李四",50,"陕西","医生");
        ls.eat();
        ls.sleep();
        ls.sayHi();
        ls.cut();
        //演示超类不能访问派生类
        Person p = new Person();
        p.name = "人";
        p.age = 1;
        p.address = "未知";
        p.eat();
        p.sleep();
        p.sayHi();
        //p.studId = "005"; //编译错误超类不能访问派生类
    }
}
